package org.data12.SpringbootDemo.mapper;

import org.apache.ibatis.annotations.*;
import org.data12.SpringbootDemo.model.Student;

import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("select * from student")
    public List<Student> findAll();

    @Insert("insert into student(sno,sname,sex,age,address) values(#{sno},#{sname},#{sex},#{age},#{address})")
    public int save(Student student);

    @Delete("delete from student where sno=#{sno}")
    int delete(Integer sno);

    @Select("select * from student where sno=#{sno}")
    Student findBySno(Integer sno);

    @Update("update student set sname=#{sname},sex=#{sex},age=#{age},address=#{address} where sno=#{sno}")
    int update(Student student);

    List<Student> findByName(String sname);
}
